﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="aboutTitle" ContentPlaceHolderID="TitleContent" runat="server">
    Quản lý xe
</asp:Content>

<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Quản lý xe</h2>
    <% using (Html.BeginForm()) { %>
    <% Html.RenderPartial("QLXeButton"); %>
    <div>
        <fieldset>
            <legend>Danh sách xe</legend>
            <table>
                <tbody>
                    <tr>
                        <th><input type="checkbox" name="checkAll" /></th>
                        <th>Tên xe</th>
                        <th>Biển số</th>
                        <th>Loại</th>
                        <th>Số ghế</th>
                        <th>Hãng sản xuất</th>
                        <th>Tình trạng</th>
                        <th colspan="2"  align="center">Lựa chọn</th>
                    </tr>
                    <%
           Dictionary<int, string> LoaiXe = (Dictionary<int, string>) ViewData["LoaiXe"];
           Dictionary<int, string> TinhTrangXe = (Dictionary<int, string>)ViewData["TinhTrangXe"];
           foreach (DTO.XeDTO xe in (List<DTO.XeDTO>)ViewData["dsXe"]) {  %>
                    <tr>
                        <td><input type="checkbox" name="check[<% Response.Write(xe.Id); %>]" /></td>
                        <td><% Response.Write(xe.TenXe); %></td>
                        <td><% Response.Write(xe.BienSo); %></td>
                        <td><% Response.Write(LoaiXe[xe.Loai]); %></td>
                        <td align="right"><% Response.Write(xe.SoGhe); %></td>
                        <td><% Response.Write(xe.HangSanXuat); %></td>
                        <td><% Response.Write(TinhTrangXe[xe.TinhTrang]); %></td>
                        <td align="center"> <%: Html.ActionLink( "Sửa", "Sua", "QLXe", new { id = xe.Id }, null)%></td>
                        <td align="center"> <%: Html.ActionLink( "Ngưng sử dụng", "ChuyenTinhTrangNgungSuDung", "QLXe", new { id = xe.Id }, null)%></td>
                    </tr>
                    <%
           } %>
                </tbody>
            </table>
        </fieldset>
    </div>
    <% } %>
</asp:Content>